package com.xuelang.pipeline.artifact.domain.resource.service.impl;

import com.xuelang.pipeline.artifact.client.common.result.PageRecord;
import com.xuelang.pipeline.artifact.client.resource.dto.ArtifactAttributeQuery;
import com.xuelang.pipeline.artifact.domain.resource.ArtifactAttribute;
import com.xuelang.pipeline.artifact.domain.resource.repository.ArtifactAttributeRepository;
import com.xuelang.pipeline.artifact.domain.resource.service.ArtifactAttributeDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 制品仓库属性领域服务实现类
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
@Service
public class ArtifactAttributeDomainServiceImpl implements ArtifactAttributeDomainService {

    @Autowired
    private ArtifactAttributeRepository artifactAttributeRepository;

    @Override
    public PageRecord<ArtifactAttribute> pageList(long currentPage, long pageSize, ArtifactAttributeQuery artifactAttributeQuery) {
        return artifactAttributeRepository.pageList(currentPage, pageSize, artifactAttributeQuery);
    }

    @Override
    public List<ArtifactAttribute> list(ArtifactAttributeQuery artifactAttributeQuery) {
        return artifactAttributeRepository.list(artifactAttributeQuery);
    }

    @Override
    public Boolean save(ArtifactAttribute artifactAttribute) {
        return artifactAttributeRepository.save(artifactAttribute);
    }

    @Override
    public Boolean update(ArtifactAttribute artifactAttribute) {
        return artifactAttributeRepository.update(artifactAttribute);
    }

    @Override
    public Boolean delete(String artifactAttributeUuid) {
        return artifactAttributeRepository.delete(artifactAttributeUuid);
    }

    @Override
    public ArtifactAttribute query(String artifactAttributeUuid) {
        return artifactAttributeRepository.query(artifactAttributeUuid);
    }

    @Override
    public void updateWebhookInfo(String artifactUuid, String webhookType, String webhookId) {
        artifactAttributeRepository.updateWebhookInfo(artifactUuid, webhookType, webhookId);
    }

    @Override
    public void updateWebhookInfoToNull(String artifactUuid) {
        artifactAttributeRepository.updateWebhookInfoToNull(artifactUuid);
    }

}
